import {View, Button, Text, Image} from '@tarojs/components';
import Taro from '@tarojs/taro';
import React, {Component} from 'react';
import * as T from '../types';
import './completeTaskModel.less';
import actions from '../actions/index';
import {connect} from 'react-redux';
import {store2Props} from '../selectors';

import {AtCurtain} from 'taro-ui';
import 'taro-ui/dist/style/components/curtain.scss';
import TaskModelBtn from '../image/TaskModelBtn.png';

type ITopProps = T.IProps & T.ITopProps;
//@ts-ignore
@connect<Partial<ITopProps>, T.ITopState>(store2Props, actions)
export default class Info extends Component<Partial<ITopProps>, T.ITopState> {
  constructor(props: ITopProps) {
    super(props);
    this.state = {};
  }

  render() {
    let {
      actions: {action},
      showTopTitle,
      isOpened,
      title,
      content,
    } = this.props;
    return (
      // @ts-ignore
      <AtCurtain
        // @ts-ignore
        isOpened={isOpened}
        onClose={() => {
          this.props.close();
        }}
      >
        <View className="completeTaskModel">
          {showTopTitle && <Text className="completeTaskModel-topTitle">提示</Text>}
          <Text className="completeTaskModelTitle">{title}</Text>
          <Text className="completeTaskModelText">{content}</Text>
          <Image
            className="completeTaskModelbg"
            src="https://ruiyinmall.oss-cn-nanjing.aliyuncs.com/ruizhimini/completeTaskModelBg.png"
          />
          <Image
            src="https://ruizhizone-test.oss-cn-nanjing.aliyuncs.com/assets/image/index/completeTaskModelBtn.png"
            className="completeTaskModelBtn"
            onClick={() => {
              this.props.close();
              Taro.navigateTo({
                url: '/pages/package-B/receiving-gifts/index',
              });
            }}
          ></Image>
        </View>
      </AtCurtain>
    );
  }
}

//create by moon https://github.com/creasy2010/moon
